/*******************************************************************************
 *  Copyright (c) 2010 Chase Technology Ltd.
 *  
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the GNU General Public License v3.0
 *  which is available at http://www.gnu.org/licenses/
 * 
 * Contributors:
 *     Doug Satchwell - initial API and implementation
 *******************************************************************************/
package org.jfunction.internal.parser;

import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.rules.IPredicateRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.MultiLineRule;
import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
import org.eclipse.jface.text.rules.Token;

/**
 * Scanner for detecting the start and end of a partition in a JBehave scenario
 * file
 * 
 * @author Doug Satchwell
 */
public class JFunctionPartitionScanner extends RuleBasedPartitionScanner {
	public static final String SCENARIO = IDocument.DEFAULT_CONTENT_TYPE;
	public static final String EXAMPLES = "__EXAMPLES";

	public JFunctionPartitionScanner(KeyWords keywords) {
		IToken examplesToken = new Token(EXAMPLES);
		
		MultiLineRule examplesRule = new MultiLineRule(keywords.examples()+":","",examplesToken,(char)0,true);
		examplesRule.setColumnConstraint(0);
		IPredicateRule[] rules = new IPredicateRule[] {
			examplesRule
		};
		setPredicateRules(rules);
	}
}
